
fs = 100;

cd ../../data/frame_data;
data = load('SC4002E0__Pz_869_N1.data','-ascii');


L = length(data);


cd ../../simulate' code'/fft/;
% E = mean(data);
%  X2 =data-E;
%  c =xcorr(X2);
%  d =c./c(L);
%  f =d(L:2*L-1);
c = xcov (data)
L = length(c)
Y = fft(c,256)/L;
%Y = fftshift(Y)
%Y = fft(data)/(L*2*pi)
L = 256
ampY = 2*abs(Y(1:L/2+1))
f = fs/2*linspace(0,1,L/2+1);

i = 50*L/fs;
figure;
set(gcf,'Color','w');  %Make the figure background white
plot(f(1:i), ampY(1:i));
set(gca,'Box','off');  %Axes on left and bottom only
title('Single-Sided Amplitude Spectrum of y(t)');
xlabel('Frequency (Hz)');
ylabel('|Y(f)|');

L =  length(data)
figure;
t = [0:0.01:L/100];
length(t)
plot(t(1:L),data(1:L))